<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=2,minimum-scale=1,maximum-scale=1,user-scalable=no">
	<link rel="stylesheet" href="css/tg_mobile_reset.css">
	<title>七牛上传MP4</title>
</head>
<body>
	<div id="app">
		<video src="" id="zc-video"  controls preload >您的浏览器不支持 video 标签。</video>
		<input type="button" value="七牛上传MP4" id="zcBtn">
	</div>
	<script src="./lib/qiniu.min.js"></script>
	<script src="./lib/plupload.min.js"></script>
	<script>
		window.onload = function() {
			var zcVideo = document.getElementById('zc-video');
			var zcBtn = document.getElementById('zcBtn');
			var uploader = Qiniu.uploader({
				runtimes: 'html5,flash,html4',      // 上传模式，依次退化
			    browse_button: zcBtn,         // 上传选择的点选按钮，必需
			    uptoken_url:"https://pre-restr-javaapis.tgljweb.com/api/qiniu/getqiniutoken",
			    get_new_uptoken: false,             // 设置上传文件的时候是否每次都重新获取新的uptoken
			    auto_start: true,                   // 选择文件后自动上传，若关闭需要自己绑定事件触发上传
			    domain:'http://img.tgljweb.com/',
			    init:{
			    	FileUploaded:function(up, file, info) {
			    		var httphead = up.getOption('domain');
		    			var key = JSON.parse(info.response).key;
		    			console.log(httphead+key);
		    			zcVideo.src=(httphead+key);
		    			// console.log(zcVideo.duration+' wocao')

			    	}
			    }
			});
			// zcVideo.oncanplay = function(ev) {
			// 	console.log(ev);
			// };
			zcVideo.oncanplaythrough = function(ev) {
				// console.log(ev.duration);
			}
			zcVideo.onload = function(ev) {
				console.log(ev.duration);
			}

		}
	</script>
</body>
</html>